

`include "../env/env.sv"

class test_base extends uvm_test;
     `uvm_component_utils(test_base)
     env env_i;
	 
	function new(string name="test_base", uvm_component parent = null);
	   super.new(name,parent);
	endfunction
	 
	virtual function void build_phase(uvm_phase phase);
		super.build_phase(phase);
		env_i = env::type_id::create("env_i",this);
		uvm_config_db#(uvm_object_wrapper)::set(this,"env_i.in_agent_i.in_agent_sequencer_i.main_phase","default_sequence",in_agent_sequence::type_id::get());
	endfunction


	virtual function void report_phase(uvm_phase phase);
	 	uvm_report_server server;
	 	int err_num, ftl_num;

	 	super.report_phase(phase);

	 	server  = get_report_server();
	 	err_num = server.get_severity_count(UVM_ERROR);
	 	ftl_num = server.get_severity_count(UVM_FATAL);

	 	if((err_num!=0) || (ftl_num!=0)) begin
	 		$display("\n***********************************");
	 		$display("*************TEST FAIL*************");
	 		$display("***********************************\n");	
	 	end else begin
	 		$display("\n***********************************");
	 		$display("*************TEST PASS*************");
	 		$display("***********************************\n");
	 	end

	endfunction
	 
	task main_phase(uvm_phase phase);
	     integer run_cyc = 50;
		
		phase.raise_objection(this,"start test main");
	     repeat (run_cyc) @(posedge riscv_soc_tb.clk);
		$display("test main end");
		phase.drop_objection(this,"done test main");
	endtask
	 
endclass

